package cn.tedu.micro.device.controller;

import cn.tedu.micro.common.pojo.protocol.JsonResult;
import cn.tedu.micro.common.pojo.vo.GunInfoVO;
import cn.tedu.micro.device.service.GunService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/device/gun")
public class GunController {
    @Value("${server.port}")
    private Integer port;
    @Autowired
    private GunService gunService;
    @GetMapping("info/{gunId}")
    public JsonResult<GunInfoVO> getGunInfo(@PathVariable Integer gunId) {
        GunInfoVO infoVO = gunService.getGunInfo(gunId);
        return JsonResult.ok("查询成功！",infoVO);
    }

    @GetMapping("hello")
    public String hello(){
        return "hello,I am from " + port;
    }
}
